{extend name="public/base"}

{block name="title"}
申请售后
{/block}

{block name="style"}
{css href="/static/wechat/css/refund.css" /}
{/block}

{block name="body"}
<div class="pageControl orderDetails">
    <div class="msui_nav msui_navTop" style="border-bottom: 1px solid #cccccc;">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">{eq name="data.audit_type" value="1"}退款详情{else /}售后详情{/eq}</h1>
    </div>
    <div class="weui-top">
        <div class="weui-panel weui-panel_access">
            <div class="weui-panel__bd">
            <span class="weui-media-box weui-media-box_appmsg span_solid">
                <img class="weui-media-box__thumb jujue_img" src="/static/wechat/images/jujuetuikuan_03.png">
              <div class="weui-media-box__bd">
                  <p class="weui-media-box__desc fs08" style="padding: 0px 15px;">{$data.status|get_order_austin_status=###, $data.audit_type}</p>
              </div>
            </span>
                <div class="weui-media-box__bd">
                    {switch name="data.status"}
                    {case value="0"}
                    <p class="weui-media-box__desc fs065 fs065color"style="padding: 20px 15px;">您已申请退款，若商家未在72小时内处理，系统将会自动推给您</p>
                    {/case}
                    {case value="1"}
                    <p class="weui-media-box__desc fs065 fs065color"style="padding: 20px 15px;">退款申请完成，款项预计在1-3个工作日到账，请注意查收</p>
                    {/case}
                    {case value="2"}
                    <p class="weui-media-box__desc fs065 fs065color"style="padding-top: 15px;">商家拒绝退款申请，拒绝原因:{$data.merchant_msg}</p>

                    {php}
                    $residue_time = $data['dispose_time'] + 3 * 24 * 60 * 60 - time();
                    $d = $h = $i = 0;
                    if($residue_time > 0) {
                    $d = $residue_time%(24 * 60 * 60);
                    $residue_time -= $d * (24 * 60 * 60);
                    if($residue_time > 0) {
                    $h = $residue_time%(60 * 60);
                    $residue_time -= $h * (60 * 60);
                    if($residue_time > 0) {
                    $i = $residue_time%(60);
                    }
                    }
                    }
                    {/php}

                    <p class="weui-media-box__desc fs065 fs065color"style="padding-bottom: 15px;">
                        若
                        {gt name="d" value="0"}
                        {$d}天
                        {/gt}
                        {gt name="h" value="0"}
                        {$h}小时
                        {/gt}
                        {gt name="i" value="0"}
                        {$i}分钟
                        {/gt}
                        内未修改申请，则退款申请自动关闭。</p>
                    {/case}
                    {/switch}
                </div>
            </div>
        </div>

        <!--退款详情-->
        <div class="tuikuandiv">
            <p>退款金额：<span>￥{$data.return_money}</span></p>
            <p>退款单号：<span>{$data.order_sn}</span></p>
            <p>申请时间：<span>{$data.add_time|date='Y-m-d H:i:s', ###}</span></p>
            <p>退款原因：<span>{$data.cause}</span></p>
            <p><span class="wentims">问题描述：</span><span class="miaoshu">{$data.msg}</span></p>

            <!--用户退款附带的图片-->
            <div class="yhimg">
                {notempty name="data.img3"}
                <div>
                    <img src="{$data.img3}" />
                </div>
                {/notempty}
                {notempty name="data.img2"}
                <div>
                    <img src="{$data.img2}" />
                </div>
                {/notempty}
                {notempty name="data.img1"}
                <div>
                    <img src="{$data.img1}" />
                </div>
                {/notempty}
            </div>
        </div>

        <!--查看完整协商记录-->
        <!--<a class="axieyi">查看完整协商记录<i class="wzright"></i></a>-->

        <!--底部-->
        <div class="fixbotm">
            {eq name="data.status" value="0"}
            <a href="{:url('save_austin', ['id' => $data['id']])}" style="background-color: #fc4208;color: #FFFFFF;">修改申请</a>
            <a href="javascript:;" class="revocation" data-id="{$data.id}">撤销申请</a>
            {/eq}
            {eq name="data.status" value="2"}
            <a href="{:url('complaint', ['id' => $data['id']])}">发起诉讼</a>
            {/eq}
            <!--<a href="../Complaints/initiatecomplaints.html"></a>-->
        </div>
    </div>

</div>
<div id="loadingToast" style="display:none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-loading weui-icon_toast"></i>
        <p class="weui-toast__content">数据加载中</p>
    </div>
</div>
{/block}

{block name="javascript"}
{js href="/static/wechat/js/refund.js" /}
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    wx.config({
        //debug: true,
        appId: '{$signPackage.appId}',
        timestamp: parseInt('{$signPackage.timestamp}'),
        nonceStr: '{$signPackage.nonceStr}',
        signature: '{$signPackage.signature}',
        jsApiList: [
            // 所有要调用的 API 都要加到这个列表中
            'previewImage'
        ]
    });
    //调微信原生查看图片
    $('.yhimg img').click(function(){
        var tmpArr = new Array();
        for(i=0;i<$('.yhimg img').length;i++){
            tmpArr[i] = $('.yhimg img')[i].src;
        }
        try{
            wx.previewImage({current:$(this)[0].src,urls:tmpArr});
        }catch(e){alert('需要在微信中查看');}
    });
</script>
<script>
    $(function () {


        $(".revocation").click(function () {
            if (!confirm('确定撤销？')) {
                return false;
            }
            var _this = $(this);
            $.get('{:url("revocation_austin")}', {id : _this.data('id')}, function (msg) {
                if (msg.code == 200) {
                    alert("撤销成功");
                    window.location.reload();
                } else {
                    var code = msg.code;
                    $.alert(error_code[code]);
                }
            });
        });
    });

</script>
{/block}